from typing import List


class Solution02:
    def removeDuplicates(self, nums: List[int]) -> int:
        a1 = nums[0]
        index = 0
        for value in nums:
            if value != a1:
                index += 1     # i++会报错
                nums[index] = value
                a1 = value
        return index + 1


if __name__ == "__main__":
    nums = [1, 1, 2]
    target = 1
    solution = Solution02()
    print(solution.removeDuplicates(nums))
